#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.61])
AC_INIT([RhythmCat], [1.0.0], [http://code.google.com/p/rhythmcat/issues/list])
AM_INIT_AUTOMAKE(RhythmCat, 1.0.0)
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])

# Set of available languages.
ALL_LINGUAS="zh_CN zh_TW ja_JP"

# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
CFLAGS="-Wall -O3 -DINSTALL_PATH=\\\"$datadir/RhythmCat/\\\""

AC_PATH_PROG(DBUSBINDINGTOOL, dbus-binding-tool, no)
if test "$DBUSBINDINGTOOL" = no; then
    AC_MSG_ERROR([dbus-binding-tool not found!])
fi

# Check for gtk-doc
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])

# Checks for libraries.
PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= 2.16, gthread-2.0 >= 2.16, \
    gmodule-2.0 >= 2.16, gio-2.0 >= 2.16])
PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1 >= 0.76])
PKG_CHECK_MODULES([GSTREAMER], [gstreamer-0.10 >= 0.10.15, \
    gstreamer-pbutils-0.10 >= 0.10.15])

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h unistd.h stdio.h limits.h signal.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T

# Checks for library functions.
AC_FUNC_FORK
AC_CHECK_FUNCS([bzero memset realpath strrchr strstr])

# Add the languages which your application supports to po/LINGUAS
GETTEXT_PACKAGE=RhythmCat
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", \
    [Define to the Gettext package name])
AM_GLIB_GNU_GETTEXT
AM_GNU_GETTEXT_VERSION([0.18.1])
AM_GNU_GETTEXT([external])

# Checks for features
AC_ARG_ENABLE(debug, [  --enable-debug          enable debug mode], \
    enable_debug=yes,)
AM_CONDITIONAL(DEBUG_MODE, test "x$enable_debug" = "xyes")

AC_ARG_ENABLE(maemo5, [  --enable-maemo5         enable Maemo5 compatiblity], \
    enable_maemo5=yes,)
AM_CONDITIONAL(USE_MAEMO5, test "x$enable_maemo5" = "xyes")

AC_ARG_ENABLE(gtk3, [  --enable-gtk3           use gtk+ 3.0 instead of gtk+ 2.0], \
    enable_gtk3=yes,)
if test "x$enable_gtk3" = "xyes"; then
    PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.0.0])
else
    PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.14.0])
fi
AM_CONDITIONAL(USE_GTK3, test "x$enable_gtk3" = "xyes")

AC_ARG_ENABLE(dbus, [  --disable-dbus          disable D-Bus modules], \
    disable_dbus=yes,)
if test "x$disable_dbus" != "xyes"; then
    PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1 >= 0.76])
fi
AM_CONDITIONAL(DISABLE_DBUS, test "x$disable_dbus" = "xyes")

AC_OUTPUT([Makefile po/Makefile.in po/Makefile src/Makefile data/Makefile \
    doc/Makefile doc/reference/Makefile data/images/Makefile
    data/icons/Makefile data/themes/Makefile data/themes/Monochrome/Makefile \
    data/themes/AeroBlue/Makefile])

AC_CONFIG_MACRO_DIR(m4)

